function distanceperseed, input, seeds, raw_dist=raw_dist
	return,  euclidean_distances(input, seeds, raw_dist=raw_dist)
end

function euclidean_distances, input, seeds, raw_dist=raw_dist
	szi =size(input, /dimensions)
	szs =size(seeds, /dimensions)
	dimdistance = (transpose(rebin(seeds, szs[0], szs[1], szi[1]), [0,2,1]) - rebin(input, szi[0], szi[1], szs[1])) ^ 2
	if(arg_present(raw_dist)) then raw_dist=dimdistance

	edist = dimdistance[0,*,*]
	for j=1l, szi[0] - 1 do edist += dimdistance[j,*,*]
	return, edist
end